Orthographic projection
The orthographic projection is the simplest projection. It resembles architectural or design drawings in that it lacks depth scaling- farther objects are not smaller.To perform the orthographic projection, the center of the view volume needs to be moved the origin. Then, the view volume must be scaled to fit into the OpenGL view volume: \( (-1, -1, -1) - (1, 1, 1) \).
If the bounds of the orthographic view volume are defined as \(left\), \(right\), \(bottom\), \(top\), \(near\), and \(var\), then the vector to translate to the origin is: $$ \begin{bmatrix} -\frac{r+l}{2} & -\frac{t+b}{2} & -\frac{n+f}{2} & \end{bmatrix} ^T $$ Forming the translation matrix: $$ \begin{bmatrix} 1 & 0 & 0 & -\frac{r+l}{2} \\ 0 & 1 & 0 & -\frac{t+b}{2} \\ 0 & 0 & 1 & -\frac{n+f}{2} \\ 0 & 0 & 0 & 1 \end{bmatrix} $$ The view volume must then be scaled by its width, height, and depth. $$ \begin{bmatrix} \frac{2}{r-l} & 0 & 0 & 0 \\ 0 & \frac{2}{t-b} & 0 & 0 \\ 0 & 0 & \frac{2}{n-f} & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} $$ The final orthographic projection is: $$ \mathbf{O} = \begin{bmatrix} \frac{2}{r-l} & 0 & 0 & 0 \\ 0 & \frac{2}{t-b} & 0 & 0 \\ 0 & 0 & \frac{2}{n-f} & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 & -\frac{r+l}{2} \\ 0 & 1 & 0 & -\frac{t+b}{2} \\ 0 & 0 & 1 & -\frac{n+f}{2} \\ 0 & 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} \frac{2}{r-l} & 0 & 0 & -\frac{r+l}{r-l} \\ 0 & \frac{2}{t-b} & 0 & -\frac{t+b}{t-b} \\ 0 & 0 & \frac{2}{n-f} & -\frac{n+f}{n-f} \\ 0 & 0 & 0 & 1 \end{bmatrix} $$